home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / MethodDescriptor.java < prev    next >
Text File  |  1998-09-22  |  2KB  |  83 lines

  1. /*
  2.  * @(#)MethodDescriptor.java    1.17 98/07/01
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.beans;
  16.  
  17. import java.lang.reflect.*;
  18.  
  19. /**
  20.  * A MethodDescriptor describes a particular method that a Java Bean
  21.  * supports for external access from other components.
  22.  */
  23.  
  24. public class MethodDescriptor extends FeatureDescriptor {
  25.  
  26.     /**
  27.      * @param method    The low-level method information.
  28.      */
  29.     public MethodDescriptor(Method method) {
  30.     this.method = method;
  31.     setName(method.getName());
  32.     }
  33.  
  34.  
  35.     /**
  36.      * @param method    The low-level method information.
  37.      * @param parameterDescriptors  Descriptive information for each of the
  38.      *                 method's parameters.
  39.      */
  40.     public MethodDescriptor(Method method, 
  41.         ParameterDescriptor parameterDescriptors[]) {
  42.     this.method = method;
  43.     this.parameterDescriptors = parameterDescriptors;
  44.     setName(method.getName());
  45.     }
  46.  
  47.     /**
  48.      * @return The low-level description of the method
  49.      */
  50.     public Method getMethod() {
  51.     return method;
  52.     }
  53.  
  54.  
  55.     /**
  56.      * @return The locale-independent names of the parameters.  May return
  57.      *        a null array if the parameter names aren't known.
  58.      */
  59.     public ParameterDescriptor[] getParameterDescriptors() {
  60.     return parameterDescriptors;
  61.     }
  62.  
  63.     /*
  64.      * Package-private constructor
  65.      * Merge two method descriptors.  Where they conflict, give the
  66.      * second argument (y) priority over the first argument (x).
  67.      * @param x  The first (lower priority) MethodDescriptor
  68.      * @param y  The second (higher priority) MethodDescriptor
  69.      */
  70.  
  71.     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
  72.     super(x,y);
  73.     method = x.method;
  74.     parameterDescriptors = x.parameterDescriptors;
  75.     if (y.parameterDescriptors != null) {
  76.         parameterDescriptors = y.parameterDescriptors;
  77.     }
  78.     }
  79.  
  80.     private Method method;
  81.     private ParameterDescriptor parameterDescriptors[];
  82. }
  83.